<!-- JSP USED TO DISPLAY ADMINISTRATORS TO BE DELETED -->
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page language="java" import="java.sql.*"%>
<%
	String userID = "";
%>

<%@page import="com.ignou.mca.datasource.DataBaseUtilities"%>
<%@page import="com.ignou.mca.beans.UserVO"%><HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>View Voters</TITLE>
</HEAD>
<BODY>
<%
	UserVO userVoObj = (UserVO) session.getAttribute("UserVO");
	if (userVoObj == null) {
		response.sendRedirect(request.getContextPath() + "/Home.htm");
	}
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0"
	bgcolor="#FFFFFF">
	<tr>
		<td height="21" bgcolor="#495e83"></td>
		<td height="21" bgcolor="#495e83"></td>
	</tr>
	<tr>
		<td height="119" align="left" valign="middle" bgcolor="#FFFFFF">
		<img alt="" src="././images/company_logo.JPG" width="304" height="53">
		</td>
		<td align="right" width="287"><img alt=""
			src="images/header_graphic.jpg" width="287" height="119"></td>
	</tr>
	<tr>
		<td height="45" width="100%" valign="middle" bgcolor="#495e83">
		&nbsp; &nbsp; &nbsp; <a href="AdminMenu.jsp" class="links" target="">Main Menu</a>
		&nbsp; &nbsp; &nbsp;<a href="Logout.jsp" class="links" target="">Logout</a>
		</td>

		<td bgcolor="#495e83"></td>
	</tr>
	<tr>
		<td height="1"><img alt="" src="images/spacer.gif" width="1"
			height="1"></td>
		<td height="1"><img alt="" src="images/spacer.gif" width="1"
			height="1"></td>
	</tr>
	<tr background="images/links_bot_fill.gif">
		<td height="30">&nbsp;</td>
		<td>&nbsp;</td>
	</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="5"
	align="center">
	<tr>
		<td bgcolor="#FFFFFF" width="20"><img alt=""
			src="images/spacer.gif" width="20" height="10"></td>
		<td bgcolor="#FFFFFF" align="left" valign="top" class="text"
			height="309" width="99%"><br>
		<!-- #BeginEditable "content" -->
		<p class="title" align="center">View Users/Voters</p>
		<BR>
		<DIV align="left">
		<TABLE border="0" cellspacing="0" cellpadding="20">
			<TR>
				<TD width="91"><B>Name</B></TD>
				<TD width="72"><B>Phone Number</B></TD>
				<TD width="72"><B>Email</B></TD>
				<TD colspan="1" width="85"><B>User Id</B></TD>
				<TD width="72"><B>Role</B></TD>
				<TD width="72"><B>Active Status</B></TD>
			</TR>
			<%
				try {
					DataBaseUtilities dbu = new DataBaseUtilities();

					Connection conn = dbu.getConnection();
					Statement st;
					st = conn.createStatement();
					ResultSet rs = st.executeQuery("select * from users");
					
					while (rs.next()) {
						String firstName = rs.getString(1);
						String lastName = rs.getString(2);
						String phone = rs.getString(8);
						String email = rs.getString(9);
						String userName = rs.getString(10);
						String Role = rs.getString(14);
						String active = rs.getString(15);

						out.print("<tr><td>" + firstName + " " + lastName
								+ "</td><td>" + phone + "</td><td>" + email
								+ "</td><td>" + userName + "</td><td>"
								+ Role.toLowerCase() + "</td><td>"
								+ active.toUpperCase() + "</td>");
						if (!Role.equalsIgnoreCase("admin")) {
			%>
			<td><a href="DeleteVoter.jsp?userID=<%=userName%>">Delete</a></td>
			<%
				}
					}
					conn.close();
				} catch (Exception e) {
				}
			%>
		</TABLE>
		<BR>
		</DIV>
		<DIV align="center">
		<CENTER><jsp:useBean id="Message"
			class="com.ignou.mca.beans.Message" scope="session">
		</jsp:useBean> <jsp:getProperty name="Message" property="message" /></CENTER>
	</tr>
	<tr>
		<td bgcolor="#495e83" width="20">&nbsp;</td>
		<td height="35" align="center" valign="middle" bgcolor="#495e83"
			class="footer">Copyright &copy; 2011 All Rights Reserved.
		Designed by Pradeepthi S</td>
		<td bgcolor="#495e83" width="20">&nbsp;</td>

	</tr>

</table>
</BODY>
</HTML>